module OrderHelper
   def orders_chart_series_1(orders_by_day, start_time)
     (start_time.to_date..Date.today).map { |date|
       order = orders_by_day.detect { |order| order.completed_at.to_date == date }
       order && order.total.to_f || 0
     }.join(',')
   end

   def orders_chart_series_2(orders_by_day, start_time)
     (start_time.to_date..Date.today).map { |date|
       order = orders_by_day.detect { |order| order.completed_at.to_date == date }
       order && order.quantity.to_i || 0
     }.join(',')
   end
end